OpenBuildings GenerativeComponents Help

The DataColumn Class

This class represents one column in the structure of a DataTable.

This class has no constructors; DataColumn objects are not user-creatable. Rather, whenever a DataTable is created, all of its DataColumn objects are created, as well.

You can access a data table's columns through its Columns property. For example:
// Obtain a data table somehow.
 
DataTable tbl = new DataTable(connection, 'SELECT * FROM Table1');
 
// Display the names and data types of all of the columns.
 
foreach (DataColumn column in tbl.Columns)
    Print(column.Name, column.DataType);
Here are the properties and methods of the DataColumn class:

int ColumnIndex { get; }

This read-only property gives the index of this column within its parent data table. The first column is at index zero.

Type DataType { get; }

This read-only property gives the type of data that can be stored this column.

string Name { get; }

This read-only property gives the name of this column.

int StatedWidth { get; }

This read-only property gives the width of this column, as it was specified when the data table's constructor was called. If no such information was given to the data table's constructor, this value is zero.

DataTable Table { get; }

This read-only property gives the data table to which this column belongs.